package com.example.springbootsecurity.controller;


import com.alibaba.fastjson.JSON;
import com.example.springbootsecurity.entity.ShiroRole;
import com.example.springbootsecurity.service.ShiroRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author vicente
 * @since 2022-01-11
 */
@Controller
@RequestMapping("/role")
public class ShiroRoleController {

    @Autowired
    private ShiroRoleService roleService;

    @RequestMapping("/getRoleByName")
    public String getRoleByName(String userName){
        List<ShiroRole> userRole = roleService.getUserRole(userName);
        return JSON.toJSONString(userRole);

    }

}
